<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
      <title>Моя карта</title>
      <link rel="shortcut icon" href="/favicon.ico" />
      <script type="text/javascript" src="http://api-maps.yandex.ru/1.1/index.xml?key=AJy6-U0BAAAAJr_5MgIAbUmUfURJX0QfQef4pLZO5vNlHjsAAAAAAAAAAACsZenVuLEihxbcpybjyqyczHDMyA=="></script>
      <script type="text/javascript" src="10100ckua.js"></script>
      <script type="text/javascript">

      function isMarkerVisible() {
         return (marker != null);
      }

      function fillUrls() {
         var markerlat = null;
         var markerlng = null;
         if (isMarkerVisible()) {
            markerlat = marker.getCoordPoint().getY();
            markerlng = marker.getCoordPoint().getX();
         }
         var maptype = (map.getType().getName() == 'Схема' ? 'map' : 'sat');
         fillUrlsCommon(map.getCenter().getY(), map.getCenter().getX(), map.getZoom(), maptype, markerlat, markerlng);
      }
      
      function processMarker() {
         if (isMarkerVisible()) {
            map.removeOverlay(marker);
            marker = null;
         } else {
            var markerCoordinates = new YMaps.GeoPoint(map.getCenter().getX(),map.getCenter().getY());
            addMarker(markerCoordinates);
         }
         fillUrls();
         markerButtons();
      }
      
      function addMarker(markerCoordinates) {
         marker = new YMaps.Placemark(markerCoordinates, {draggable: true});
	      map.addOverlay(marker);
         YMaps.Events.observe(marker, marker.Events.DragEnd, fillUrls);
         YMaps.Events.observe(marker, marker.Events.BalloonOpen, function () {
            marker.closeBalloon();
         });
      }

      
      function initialize() {

         initMapCanvasSize();

         var lat = getParameter('lat');
         if (lat == null || isNaN(lat))
            lat = def_lat;
         var lng = getParameter('lng');
         if (lng == null || isNaN(lat))
            lng = def_lng;
         var z = parseInt(getParameter('z'));
         if (z == null || isNaN(z))
            z = def_zoom;

         var mapType = getParameter('t');
         if (mapType == null)
            mapType = YMaps.MapType.MAP;
         else 
            if (mapType == 'sat')
              mapType = YMaps.MapType.HYBRID;
            else 
              mapType = YMaps.MapType.MAP;

         var mlat = getParameter('mlat');
         var mlng = getParameter('mlng');
         var markerCoordinates = null;
         if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) {
            markerCoordinates = new YMaps.GeoPoint(mlng,mlat);
         }
            

         var mapCenter = new YMaps.GeoPoint(lng,lat);
         
         map = new YMaps.Map(document.getElementById("map_canvas"));
         map.setCenter(mapCenter, z, mapType);

         
         map.addControl(new YMaps.TypeControl());
         map.addControl(new YMaps.Zoom());
         map.addControl(new YMaps.ScaleLine());
         map.enableScrollZoom();

         YMaps.Events.observe(map, map.Events.Update, fillUrls);
         YMaps.Events.observe(map, map.Events.MoveEnd, fillUrls);
         YMaps.Events.observe(map, map.Events.DragEnd, fillUrls);
         YMaps.Events.observe(map, map.Events.MultiTouchEnd, fillUrls);
         YMaps.Events.observe(map, map.Events.SmoothZoomEnd, fillUrls);

         YMaps.Events.observe(map, map.Events.TypeChange, fillUrls);


         // MARKER
         if (markerCoordinates != null) {
            addMarker(markerCoordinates);
         }


         fillUrls();

         initMarkerButtons(isMarkerVisible());
         //initStyleButtons();
      }

      function resizeMap() {
         map.redraw(true, null);
         fillUrls();
      }
      

      </script>
      <script type="text/javascript">
      
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-1390959-7']);
        _gaq.push(['_trackPageview']);
      
        (function() {
          var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
          ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
          var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();
      
      </script>
   </head>
   <body onload="initialize()">

      <div id="map_canvas" style="width: 500px; height: 300px"></div>

      <div id="div_url" style="width: 500px; height: 65px">
         <br/>
         <a href="" id="refresh" >Обновить</a>&nbsp;
         <input id="textlink" value="" title="Адрес карты" size="60" type="text" maxlength="2048" 
            spellcheck="false" style="width: 500px;"/><br/>
      </div>
      <div id="map_links" style="width: 500px; height: 120px">
         <table border="0" cellpadding="10" cellspacing="0">
            <tr valign="top">
            <td><a href="google-maps.html" id="google-maps">
               <img border="0" src="images/google.jpg"><br/>
               google</a><br/></td>
            <td><a href="yandex-maps.html" id="yandex-maps" >
               <img border="0" src="images/yandex.jpg"><br/>
               yandex</a><br/></td>
            <td><a href="visicom-maps.html" id="visicom-maps" >
               <img border="0" src="images/visicom.jpg"><br/>
               visicom</a><br/></td>
            <td><a href="google-maps-mobile.html" id="google-maps-mobile">
               <img border="0" src="images/google.jpg"><br/>
               google<br/> mobile</a><br/></td>
            </tr>
         </table>
      </div>
      <form> 
         <input id="setmarker" type="button" value="Поставить маркер" name="button1" onClick="processMarker()">
         <input id="removemarker" type="button" value="Убрать маркер" name="button2" onClick="processMarker()">  
      </form>
      <br/>
      <form>
         <input id="resizeMicro" type="button" value="Размер микро" name="button0" onClick="resizeMap0()">
         <input id="resizeNormal" type="button" value="Размер A" name="button1" onClick="resizeMapA()">
         <input id="resizeLarge" type="button" value="Размер B" name="button2" onClick="resizeMapB()">
         <input id="resizeCurrent" type="button" value="Размер экрана" name="button3" onClick="resizeMapMax()">
      </form>
      
   </body>
   
</html>
